﻿using System;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using DataAccessObject;
using SharedLibraries;
using SharedLibraries.Constants;
using ThangNM_LIB.EO;
using ThangNM_LIB.FUNC;

namespace ThangNM
{
    public partial class CommonForm : System.Web.UI.Page
    {
        public ThangNM.PublicInterface.Home_New mtpHome;

        protected void Page_Load(object sender, EventArgs e)
        {
            mtpHome = Master as ThangNM.PublicInterface.Home_New;
            mtpHome.setClearMsg();
            cphUC.Controls.Clear();
            switch (StringEx.Trim(Request.QueryString[QueryString.request]).ToLower())
            {
                case "search":
                    cphUC.Controls.Add((ThangNM.UserControl.Google_CSEUC)Page.LoadControl("~/UserControl/Google_CSEUC.ascx"));
                    break;
                case "sitemap":
                    cphUC.Controls.Add((ThangNM.UserControl.SitemapUC)Page.LoadControl("~/GlobalResources/SourceCode/SitemapUC.ascx"));
                    HtmlGenericControl linktag;
                    linktag = new HtmlGenericControl("link");
                    linktag.Attributes["rel"] = "stylesheet";
                    linktag.Attributes["type"] = "text/css";
                    linktag.Attributes["href"] = "http://nguyenmanhthang.net/App_Themes/treeview.css";
                    Header.Controls.Add(linktag);
                    break;
                case "donate":
                    cphUC.Controls.Add((ThangNM.UserControl.DonateUC)Page.LoadControl("~/UserControl/DonateUC.ascx"));
                    break;
                case "job":
                    cphUC.Controls.Add((ThangNM.UserControl.JobAdvUC)Page.LoadControl("~/UserControl/JobAdvUC.ascx"));
                    break;
            }

            SEOEO _SEOEO = new SEOEO();
            _SEOEO = (new CategoryDAO()).SelectBy_sQueryString_sUrl("", OtherEx.RemoveDomainInUrl(Request.RawUrl));
            Commons.setSEO_ON_PAGE(Page, _SEOEO, this.GetType());
        }
    }
}